package com.zhenfan.pattern;

/**
 * 满减策略
 *
 * @author wangmh
 * @create 2018-11-08 14:48
 **/
public class FullReductionStrategy implements SaleStrategy {

    private static final FullReductionStrategy instance = new FullReductionStrategy();

    private FullReductionStrategy() {}

    public static FullReductionStrategy getInstance() {
        return instance;
    }

    @Override
    public double getPaidAmount(double amount) {
        double paid = amount;
        // 满300减150
        if (paid > 300) {
            paid = paid - 150;
        }
        System.out.println("满300减150，应付：" + amount + "，实付：" + amount);
        return paid;
    }

}
